﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.Model;
using GtsServer.DAL;
using System.Data;
using GtsServer.Common;

namespace GtsServer.Manage.Controller
{
    public class TaskConditionController
    {
        TaskConditionDAL dal = new TaskConditionDAL();
        public List<TaskCondition> GetList(int taskID)
        {
            DataSet ds = dal.GetList(taskID);
            return IListDataSet.DataSetToIList<TaskCondition>(ds, 0).ToList();
        }

        public List<TaskConditionShow> GetListAndPrizeName(int taskID)
        {
            DataSet ds = dal.GetListAndPrizeName(taskID);
            List<TaskConditionShow> list = IListDataSet.DataSetToIList<TaskConditionShow>(ds, 0).ToList();
            foreach (var item in list)
            {
                TaskConditionShow.InitModelAndMouldName(item);
            }
            return list;
        }

        public int Add(TaskCondition model)
        {
            return dal.Add(model);
        }

        public bool Update(TaskCondition model)
        {
            return dal.Update(model);
        }

        public bool Delete(int id)
        {
            return dal.Delete(id);
        }
    }
}
